
import gradio as gr

def count_letters(text: str, target: str) -> int:
    """统计目标字符在文本中的出现次数"""
    return text.lower().count(target.lower())

gr.Interface(
    fn=count_letters,
    inputs=["text", "text"],
    outputs="number",
    title="字母计数器"
).launch(mcp_server=True)
